<template>
	<u-list :height="screenHeight">
	<view class="back-color">
		<view class="result-top">
			<text>结果分析</text>
			<text>本测试由AI得出，仅供参考，不能作为诊断及治疗的依据。</text>
		</view>
		<view class="result-desc">
			<view>111</view>
			<view>222</view>
			<view class="bold">测评结果概述：</view>
			<view class="">0000</view>
			<view class="bold">AI为你推荐以下科室</view>
			<view class="">
				<view class="recommend">
					<label>
						<text class="bold">333</text>
						<text class="Hosp">444</text>
					</label>
					<label class="regi">去挂号</label>
				</view>
			</view>
		</view>
		<!-- 底部按钮 -->
		<view class="sub-box">
			<view class="sub-btn"><u-button type="success"  openType="share" text="邀请朋友测一测"></u-button></view>
			<view class="sub-btn"><u-button type="primary" @click="goBack"  text="再测一次"></u-button></view>
		</view>
	</view>
	</u-list>
</template>

<script>
	import {getDepressionResApi,getInsomniaResApi} from "../../../../utils/api.js"
export default {
	data() {
		return {
			// 页面高度
			screenHeight: 0,
			// 所传答案的值
			idList:[],
			// 判断请求什么值,001请求抑郁症,002请求失眠
			flag:"",
		};
	},
	methods:{
		goShare(){
			uni.share({
				provider: "weixin",
				scene: "WXSceneSession",
				type: 1,
				summary: "我正在使用HBuilderX开发uni-app，赶紧跟我一起来体验！",
				success: function (res) {
					console.log("success:" + JSON.stringify(res));
				},
				fail: function (err) {
					console.log("fail:" + JSON.stringify(err));
				}
			});
		},
		// 再测试一次
		goBack(){
			uni.redirectTo({
				url:"../topic/topic?flag="+this.flag
			})
		},
		// 获取抑郁症的题目
		async getDepressionRes(){
			const res = await getDepressionResApi({valeu:this.idList})
			console.log(res);
		},
		// 获取失眠的题目
		async getInsomniaRes(){
			const res = await getInsomniaResApi({valeu:this.idList})
			console.log(res);
		},
	},
	onLoad(option) {
		// console.log(JSON.parse(option.value));
		let {idList,flag} = JSON.parse(option.value)
		this.idList = idList
		this.flag = flag
	},
	onShow() {
		if(this.flag == '001'){
			// this.getDepressionRes()
		}else{
			// this.getInsomniaRes()
		}
	},
	mounted() {
		//获取页面高度
		this.screenHeight = uni.getSystemInfoSync().windowHeight - 60; //获取当前页面的高度
	},
	// 分享给好友
	onShareAppMessage(){
		 return {
		       title: '看看我的测试结果吧!',
		       path: 'pages/component/personTest/result/result',
			   imageUrl:""
		     }
	}
};
</script>

<style lang="less">
page {
	background: #f0f5f9;
}
.back-color {
	background: -webkit-linear-gradient(top, #d6e8ff 30%, #f2f7fb 55%, #f0f5f9 90%);
}
.result-top {
	display: flex;
	flex-direction: column;
	padding: 20rpx;
}
.result-top text:nth-child(1) {
	font-size: 35rpx;
	font-weight: bold;
	padding-bottom: 20rpx;
}
.result-desc {
	background-color: #ffffff;
	border-radius: 10rpx;
	margin: 20rpx;
	padding: 20rpx;
}
.result-desc view {
	margin-bottom: 20rpx;
	line-height: 1.5;
}
.result-desc view:nth-child(1) {
	font-size: 40rpx;
	font-weight: bold;
	color: #0d7cff;
}
.result-desc view:nth-child(2) {
	color: #0d7cff;
}
.bold {
	font-weight: bold;
	display: block;
}
.recommend {
	background-color: #f4f7fa;
	border-radius: 10rpx;
	padding: 30rpx 20rpx;
	display: flex;
	justify-content: space-between;
}
.Hosp {
	color: #bac5cc;
}
.regi {
	align-self: center;
	background-color: #0176ff;
	color: #ffffff;
	padding: 10rpx 20rpx;
	border-radius: 10rpx;
}
.exceed {
	height: 300rpx;
	background: #f0f5f9;
}
// 底部按钮
.sub-box {
	background-color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-top: 1rpx #f5f5f5 solid;
	padding: 0 26rpx;
	height: 120rpx;
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	.sub-btn {
		width: 44%;
	}
}
</style>
